<?php
/*使用文本文件记录数据的简单实现*/
// $counter=1;
// if(file_exists("mycounter.txt")){
// 	$fp=fopen("mycounter.txt","r");
// 	$counter=fgets($fp,9);
// 	$counter++;
// 	fclose($fp);
// 	}
// 	$fp=fopen("mycounter.txt","w");
// 	fputs($fp,$counter);
// 	fclose($fp);
// 	echo "<h1>您是第".$counter."次访问本页面！<h1>";
	
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
@ini_set('display_errors',        2);
@error_reporting(E_ALL);
$memcached = new memcached;
$memcached->addServer('localhost', 11211);
$sa = $_SESSION['user_id'];
echo "<pre>";
print_r($sa);
echo "</pre>";
exit;

$memcached->set('test',1);
$data[] = $memcached->getAllKeys();
$mem2 = new memcached;
$mem2->setOption(Memcached::OPT_BINARY_PROTOCOL, true); //使用binary二进制协议
$mem2->addServer('10.129.24.8', 11211);
$mem2->setSaslAuthData('www','84869280');
$data[] = $mem2->get('test');



if($s=$memcached->get('a')) {

    $s=$s+1;

    $memcached->set('a',$s);

}

else

$memcached->set('a',1);

echo '访问结果为：'.$s;

?>
